import pandas as pd
import glob

outputfile = 'order_20161101_clean.csv'

csv_list = glob.glob('order_20161101.csv')
print(u'共发现%s个CSV文件' % len(csv_list))
print(u'正在处理............')


def hebing():
    for inputfile in csv_list:
        f = open(inputfile)
        data = pd.read_csv(f)
        data.to_csv(outputfile, mode='a', index=False, header=None)
    print('完成合并')


def quchong(file):
    df = pd.read_csv(file, header=0)
    datalist = df.drop_duplicates()
    datalist.to_csv(file)
    print('完成去重')


if __name__ == '__main__':
    hebing()
    quchong(outputfile)